1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gio.UnixMountEntry; 26 27 private import gio.IconIF; 28 private import gio.c.functions; 29 public import gio.c.types; 30 private import glib.ListG; 31 private import glib.Str; 32 private import glib.c.functions; 33 private import gobject.ObjectG; 34 35 36 /** 37 * Defines a Unix mount entry (e.g. <filename>/media/cdrom</filename>). 38 * This corresponds roughly to a mtab entry. 39 */ 40 public class UnixMountEntry 41 { 42 /** the main Gtk struct */ 43 protected GUnixMountEntry* gUnixMountEntry; 44 protected bool ownedRef; 45 46 /** Get the main Gtk struct */ 47 public GUnixMountEntry* getUnixMountEntryStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gUnixMountEntry; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gUnixMountEntry; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GUnixMountEntry* gUnixMountEntry, bool ownedRef = false) 64 { 65 this.gUnixMountEntry = gUnixMountEntry; 66 this.ownedRef = ownedRef; 67 } 68 69 70 /** */ 71 public static GType getType() 72 { 73 return g_unix_mount_entry_get_type(); 74 } 75 76 /** 77 * Determines if @mount_path is considered an implementation of the 78 * OS. This is primarily used for hiding mountable and mounted volumes 79 * that only are used in the OS and has little to no relevance to the 80 * casual user. 81 * 82 * Params: 83 * mountPath = a mount path, e.g. `/media/disk` or `/usr` 84 * 85 * Returns: %TRUE if @mount_path is considered an implementation detail 86 * of the OS. 87 */ 88 public static bool isMountPathSystemInternal(string mountPath) 89 { 90 return g_unix_is_mount_path_system_internal(Str.toStringz(mountPath)) != 0; 91 } 92 93 /** 94 * Gets a #GUnixMountEntry for a given mount path. If @time_read 95 * is set, it will be filled with a unix timestamp for checking 96 * if the mounts have changed since with g_unix_mounts_changed_since(). 97 * 98 * If more mounts have the same mount path, the last matching mount 99 * is returned. 100 * 101 * This will return %NULL if there is no mount point at @mount_path. 102 * 103 * Params: 104 * mountPath = path for a possible unix mount. 105 * timeRead = guint64 to contain a timestamp. 106 * 107 * Returns: a #GUnixMountEntry. 108 */ 109 public static UnixMountEntry at(string mountPath, out ulong timeRead) 110 { 111 auto __p = g_unix_mount_at(Str.toStringz(mountPath), &timeRead); 112 113 if(__p is null) 114 { 115 return null; 116 } 117 118 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) __p, true); 119 } 120 121 /** 122 * Compares two unix mounts. 123 * 124 * Params: 125 * mount2 = second #GUnixMountEntry to compare. 126 * 127 * Returns: 1, 0 or -1 if @mount1 is greater than, equal to, 128 * or less than @mount2, respectively. 129 */ 130 public int compare(UnixMountEntry mount2) 131 { 132 return g_unix_mount_compare(gUnixMountEntry, (mount2 is null) ? null : mount2.getUnixMountEntryStruct()); 133 } 134 135 /** 136 * Frees a unix mount. 137 */ 138 public void free() 139 { 140 g_unix_mount_free(gUnixMountEntry); 141 } 142 143 /** 144 * Gets the device path for a unix mount. 145 * 146 * Returns: a string containing the device path. 147 */ 148 public string getDevicePath() 149 { 150 return Str.toString(g_unix_mount_get_device_path(gUnixMountEntry)); 151 } 152 153 /** 154 * Gets the filesystem type for the unix mount. 155 * 156 * Returns: a string containing the file system type. 157 */ 158 public string getFsType() 159 { 160 return Str.toString(g_unix_mount_get_fs_type(gUnixMountEntry)); 161 } 162 163 /** 164 * Gets the mount path for a unix mount. 165 * 166 * Returns: the mount path for @mount_entry. 167 */ 168 public string getMountPath() 169 { 170 return Str.toString(g_unix_mount_get_mount_path(gUnixMountEntry)); 171 } 172 173 /** 174 * Guesses whether a Unix mount can be ejected. 175 * 176 * Returns: %TRUE if @mount_entry is deemed to be ejectable. 177 */ 178 public bool guessCanEject() 179 { 180 return g_unix_mount_guess_can_eject(gUnixMountEntry) != 0; 181 } 182 183 /** 184 * Guesses the icon of a Unix mount. 185 * 186 * Returns: a #GIcon 187 */ 188 public IconIF guessIcon() 189 { 190 auto __p = g_unix_mount_guess_icon(gUnixMountEntry); 191 192 if(__p is null) 193 { 194 return null; 195 } 196 197 return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p, true); 198 } 199 200 /** 201 * Guesses the name of a Unix mount. 202 * The result is a translated string. 203 * 204 * Returns: A newly allocated string that must 205 * be freed with g_free() 206 */ 207 public string guessName() 208 { 209 auto retStr = g_unix_mount_guess_name(gUnixMountEntry); 210 211 scope(exit) Str.freeString(retStr); 212 return Str.toString(retStr); 213 } 214 215 /** 216 * Guesses whether a Unix mount should be displayed in the UI. 217 * 218 * Returns: %TRUE if @mount_entry is deemed to be displayable. 219 */ 220 public bool guessShouldDisplay() 221 { 222 return g_unix_mount_guess_should_display(gUnixMountEntry) != 0; 223 } 224 225 /** 226 * Guesses the symbolic icon of a Unix mount. 227 * 228 * Returns: a #GIcon 229 * 230 * Since: 2.34 231 */ 232 public IconIF guessSymbolicIcon() 233 { 234 auto __p = g_unix_mount_guess_symbolic_icon(gUnixMountEntry); 235 236 if(__p is null) 237 { 238 return null; 239 } 240 241 return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p, true); 242 } 243 244 /** 245 * Checks if a unix mount is mounted read only. 246 * 247 * Returns: %TRUE if @mount_entry is read only. 248 */ 249 public bool isReadonly() 250 { 251 return g_unix_mount_is_readonly(gUnixMountEntry) != 0; 252 } 253 254 /** 255 * Checks if a Unix mount is a system mount. This is the Boolean OR of 256 * g_unix_is_system_fs_type(), g_unix_is_system_device_path() and 257 * g_unix_is_mount_path_system_internal() on @mount_entry’s properties. 258 * 259 * The definition of what a ‘system’ mount entry is may change over time as new 260 * file system types and device paths are ignored. 261 * 262 * Returns: %TRUE if the unix mount is for a system path. 263 */ 264 public bool isSystemInternal() 265 { 266 return g_unix_mount_is_system_internal(gUnixMountEntry) != 0; 267 } 268 269 /** 270 * Checks if the unix mount points have changed since a given unix time. 271 * 272 * Params: 273 * time = guint64 to contain a timestamp. 274 * 275 * Returns: %TRUE if the mount points have changed since @time. 276 */ 277 public static bool pointsChangedSince(ulong time) 278 { 279 return g_unix_mount_points_changed_since(time) != 0; 280 } 281 282 /** 283 * Gets a #GList of #GUnixMountPoint containing the unix mount points. 284 * If @time_read is set, it will be filled with the mount timestamp, 285 * allowing for checking if the mounts have changed with 286 * g_unix_mount_points_changed_since(). 287 * 288 * Params: 289 * timeRead = guint64 to contain a timestamp. 290 * 291 * Returns: a #GList of the UNIX mountpoints. 292 */ 293 public static ListG mountPointsGet(out ulong timeRead) 294 { 295 auto __p = g_unix_mount_points_get(&timeRead); 296 297 if(__p is null) 298 { 299 return null; 300 } 301 302 return new ListG(cast(GList*) __p, true); 303 } 304 305 /** 306 * Checks if the unix mounts have changed since a given unix time. 307 * 308 * Params: 309 * time = guint64 to contain a timestamp. 310 * 311 * Returns: %TRUE if the mounts have changed since @time. 312 */ 313 public static bool mountsChangedSince(ulong time) 314 { 315 return g_unix_mounts_changed_since(time) != 0; 316 } 317 318 /** 319 * Gets a #GList of #GUnixMountEntry containing the unix mounts. 320 * If @time_read is set, it will be filled with the mount 321 * timestamp, allowing for checking if the mounts have changed 322 * with g_unix_mounts_changed_since(). 323 * 324 * Params: 325 * timeRead = guint64 to contain a timestamp, or %NULL 326 * 327 * Returns: a #GList of the UNIX mounts. 328 */ 329 public static ListG mountsGet(out ulong timeRead) 330 { 331 auto __p = g_unix_mounts_get(&timeRead); 332 333 if(__p is null) 334 { 335 return null; 336 } 337 338 return new ListG(cast(GList*) __p, true); 339 } 340 341 /** 342 * Makes a copy of @mount_entry. 343 * 344 * Returns: a new #GUnixMountEntry 345 * 346 * Since: 2.54 347 */ 348 public UnixMountEntry copy() 349 { 350 auto __p = g_unix_mount_copy(gUnixMountEntry); 351 352 if(__p is null) 353 { 354 return null; 355 } 356 357 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) __p, true); 358 } 359 360 /** 361 * Gets a #GUnixMountEntry for a given file path. If @time_read 362 * is set, it will be filled with a unix timestamp for checking 363 * if the mounts have changed since with g_unix_mounts_changed_since(). 364 * 365 * If more mounts have the same mount path, the last matching mount 366 * is returned. 367 * 368 * This will return %NULL if looking up the mount entry fails, if 369 * @file_path doesn’t exist or there is an I/O error. 370 * 371 * Params: 372 * filePath = file path on some unix mount. 373 * timeRead = guint64 to contain a timestamp. 374 * 375 * Returns: a #GUnixMountEntry. 376 * 377 * Since: 2.52 378 */ 379 public static UnixMountEntry mountFor(string filePath, out ulong timeRead) 380 { 381 auto __p = g_unix_mount_for(Str.toStringz(filePath), &timeRead); 382 383 if(__p is null) 384 { 385 return null; 386 } 387 388 return ObjectG.getDObject!(UnixMountEntry)(cast(GUnixMountEntry*) __p, true); 389 } 390 391 /** 392 * Gets a comma-separated list of mount options for the unix mount. For example, 393 * `rw,relatime,seclabel,data=ordered`. 394 * 395 * This is similar to g_unix_mount_point_get_options(), but it takes 396 * a #GUnixMountEntry as an argument. 397 * 398 * Returns: a string containing the options, or %NULL if not 399 * available. 400 * 401 * Since: 2.58 402 */ 403 public string getOptions() 404 { 405 return Str.toString(g_unix_mount_get_options(gUnixMountEntry)); 406 } 407 408 /** 409 * Gets the root of the mount within the filesystem. This is useful e.g. for 410 * mounts created by bind operation, or btrfs subvolumes. 411 * 412 * For example, the root path is equal to "/" for mount created by 413 * "mount /dev/sda1 /mnt/foo" and "/bar" for 414 * "mount --bind /mnt/foo/bar /mnt/bar". 415 * 416 * Returns: a string containing the root, or %NULL if not supported. 417 * 418 * Since: 2.60 419 */ 420 public string getRootPath() 421 { 422 return Str.toString(g_unix_mount_get_root_path(gUnixMountEntry)); 423 } 424 }